#ifndef _DB_MYSQL_H_
#define _DB_MYSQL_H_

#include <mysql/mysql.h>
#include <string>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include "glog/logging.h"
#include "FormatConversion.h"
using namespace std;

class MySql_DB
{
 public:
     MySql_DB(string v_strServer,string v_strUser,string v_strPassword );
     ~MySql_DB();

private:
        MYSQL       m_sql;
        MYSQL_RES  *m_pRes;
        MYSQL_ROW   m_Row;

        string  m_strServer;
        string  m_strUser;
        string  m_strPassword;
 public:
        bool ConnectToServer(string v_strDataBase);
        bool InsertToTableUser(string v_strUserName ,
                               string v_strPassword ,
                               string v_strDeviceID);
        int JudgeLogin(string v_strUserName ,
                        string v_strPassword );
        int  InsertLoginTimeAndGetId(int v_nUserId ,string v_strLoginTime );
        bool SetLogoutTimeById(int v_Id,string v_strLogoutTime);

        bool SetDeviceStateById(int v_Id,string v_strState);

};




#endif // _DB_MYSQL_H_
